gdkgl.c: Avoid GCCism in Pointer Arithmetic
authorChun-wei Fan <fanchunwei@src.gnome.org>
Mon, 24 Nov 2014 03:05:18 +0000 (11:05 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Mon, 24 Nov 2014 14:57:25 +0000 (22:57 +0800)
NULL-plus-something could be seen by the compiler to attempt to do
arithmetic with void *, which is a GCCism.  Instead, do the math normally
and cast the results as a void *.

https://bugzilla.gnome.org/show_bug.cgi?id=740605

gdk/gdkgl.c

index 73888a2ee2a91cf0f5b5ef403b4e5fd4ae85e706..6791960100a0a495cae392970ba6787d7c3a8398 100644 (file)
@@ -240,7 +240,7 @@ gdk_gl_texture_quads (GdkGLContext *paint_context,
   glBindBuffer (GL_ARRAY_BUFFER, paint_data->tmp_vertex_buffer);
 
   glVertexAttribPointer (program->position_location, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, NULL);
-  glVertexAttribPointer (program->uv_location, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, NULL + sizeof(float) * 2);
+  glVertexAttribPointer (program->uv_location, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, (void *) (sizeof(float) * 2));
 
 #define VERTEX_SIZE 4